don't destroy a buttons child if it isn't a label.
authorTim Janik <timj@gtk.org>
Tue, 14 Jul 1998 17:48:28 +0000 (17:48 +0000)
committerTim Janik <timj@src.gnome.org>
Tue, 14 Jul 1998 17:48:28 +0000 (17:48 +0000)
Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
        child if it isn't a label.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkbutton.c

index a3a1d27bea697c6621374041a00c1b9500af86e0..87d08235e26bb6d27343bee856f9ec6ddb2f694e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
+       child if it isn't a label.
+
 Tue Jul 14 11:41:38 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkdialog.h: 
index a3a1d27bea697c6621374041a00c1b9500af86e0..87d08235e26bb6d27343bee856f9ec6ddb2f694e 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
+       child if it isn't a label.
+
 Tue Jul 14 11:41:38 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkdialog.h: 
index a3a1d27bea697c6621374041a00c1b9500af86e0..87d08235e26bb6d27343bee856f9ec6ddb2f694e 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
+       child if it isn't a label.
+
 Tue Jul 14 11:41:38 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkdialog.h: 
index a3a1d27bea697c6621374041a00c1b9500af86e0..87d08235e26bb6d27343bee856f9ec6ddb2f694e 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
+       child if it isn't a label.
+
 Tue Jul 14 11:41:38 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkdialog.h: 
index a3a1d27bea697c6621374041a00c1b9500af86e0..87d08235e26bb6d27343bee856f9ec6ddb2f694e 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
+       child if it isn't a label.
+
 Tue Jul 14 11:41:38 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkdialog.h: 
index a3a1d27bea697c6621374041a00c1b9500af86e0..87d08235e26bb6d27343bee856f9ec6ddb2f694e 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
+       child if it isn't a label.
+
 Tue Jul 14 11:41:38 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkdialog.h: 
index a3a1d27bea697c6621374041a00c1b9500af86e0..87d08235e26bb6d27343bee856f9ec6ddb2f694e 100644 (file)
@@ -1,3 +1,8 @@
+Tue Jul 14 19:12:12 1998  Tim Janik  <timj@gtk.org>
+
+       * gtk/gtkbutton.c (gtk_button_set_arg): don't destroy a buttons
+       child if it isn't a label.
+
 Tue Jul 14 11:41:38 1998  Tim Janik  <timj@gtk.org>
 
        * gtk/gtkdialog.h: 
index decbbe68124badbe61c48a6b82eb93f7702b4bd8..d8002c62f168570a40c356ba7d2876044df0023c 100644 (file)
@@ -234,16 +234,18 @@ gtk_button_set_arg (GtkObject *object,
 
   switch (arg_id)
     {
-      GtkWidget *label;
+      GtkWidget *child;
 
     case ARG_LABEL:
-      if (GTK_BIN (button)->child)
-       gtk_container_remove (GTK_CONTAINER (button), GTK_BIN (button)->child);
-
-      label = gtk_label_new (GTK_VALUE_STRING(*arg) ? GTK_VALUE_STRING(*arg) : "");
-      gtk_widget_show (label);
-
-      gtk_container_add (GTK_CONTAINER (button), label);
+      child = GTK_BIN (button)->child;
+      if (!child)
+       child = gtk_widget_new (GTK_TYPE_LABEL,
+                               "visible", TRUE,
+                               "parent", button,
+                               NULL);
+      if (GTK_IS_LABEL (child))
+       gtk_label_set (GTK_LABEL (child),
+                      GTK_VALUE_STRING (*arg) ? GTK_VALUE_STRING (*arg) : "");
       break;
     case ARG_RELIEF:
       gtk_button_set_relief (button, GTK_VALUE_ENUM (*arg));